package br3akr.DeadlyDinnerParty.Server.World;

import java.util.HashSet;
import java.util.Set;

public class Item implements IsHidable {
	private String name;
	private static int id;
	private String itemId;
	private String description;
	private Set<String> actions;
	private Set<GameCharacter> hiddenFromList;
	private boolean isHidden;
	private String hiddenDesc;
	
	public Item(String name, String description, Set<String> actions) {
		itemId = Integer.toString(id++);
		this.name = name;
		this.description = description;
		this.actions = actions;
		hiddenFromList = new HashSet<GameCharacter>();
	}
	
	public String getName() {
		return name;
	}
	
	public void setName(String name) {
		this.name = name;
	}
	
	public String getId() {
		return itemId;
	}
	
	public String getDescription() {
		return description;
	}
	
	public void setDescription(String description) {
		this.description = description;
	}
	
	public boolean canDoAction(String action) {
		return actions.contains(action);
	}
	
	@Override
	public boolean isHiddenFrom(GameCharacter c) {
		return hiddenFromList.contains(c);
	}

	@Override
	public void addHiddenFrom(GameCharacter c) {
		hiddenFromList.add(c);
	}

	@Override
	public void removeHiddenFrom(GameCharacter c) {
		hiddenFromList.remove(c);
	}
	
	@Override
	public void hide(String hideDesc) {
		isHidden = true;
		hiddenDesc = hideDesc;
	}

	@Override
	public void unhide() {
		isHidden = false;
		hiddenDesc = null;
	}
	
	@Override
	public boolean isHidden() {
		return isHidden;
	}
	
	@Override
	public String getHiddenDescription() {
		return hiddenDesc;
	}
}
